/**
 * 代理帮助
  */
module game {

    export class ProxyHelpMediator extends BaseMediator {
        public static NAME: string = "ProxyHelpMediator";
        private obj;
        public constructor(viewComponent: any = null) {
            super(ProxyHelpMediator.NAME, viewComponent);
        }

        public listNotificationInterests(): Array<any> {
            return [
                PanelNotify.HALL.STAGE_RESIZE,
                PanelNotify.HALL.OPEN_PROXY_HELP,
                PanelNotify.HALL.CLOSE_PROXY_HELP
            ];
        }
        private panel: ProxyHelpPanel;
        public handleNotification(notification: puremvc.INotification): void {
            switch (notification.getName()) {
                case PanelNotify.HALL.STAGE_RESIZE:
                    if (this.panel) {
                        this.panel.width = GameConfig.curWidth()
                        this.panel.height = GameConfig.curHeight()
                    }
                    break;
                case PanelNotify.HALL.OPEN_PROXY_HELP: {
                    this.obj = notification.getBody();
                    this.panel = null;
                    this.panel = new ProxyHelpPanel();
                    this.showUI(this.panel, 2, 1, true);
                    break;
                }
                case PanelNotify.HALL.CLOSE_PROXY_HELP: {
                    this.closePanel(0);
                    break;
                }
            }
        }

        /**
         * 初始化面板ui
         */
        public initUI(): void {
            this.panel.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.closeButtonClick, this);
        }

        /**
         * 初始化面板数据
         */
        public initData(): void {
           
        }
        private closeButtonClick(event: egret.TouchEvent): void {
            SoundManage.startAnniuBtnLoad();
            this.closePanel(1);
        }
    }
}